package zhoug.demo.zui.ui;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import zhoug.common.utils.ResourceUtils;
import zhoug.demo.zui.R;
import zhoug.zui.map.ChinaArea;
import zhoug.zui.map.Marker;
import zhoug.zui.map.ZUIChinaMapView;

public class ChinaMapActivity extends AppCompatActivity {

    private ZUIChinaMapView mChinaMapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_china_map);
        findViews();

        List<Marker> markers=new ArrayList<>();
        Marker  marker = new Marker();
        marker.setIcon(ContextCompat.getDrawable(this, R.drawable.zui_icon_checked));
        marker.setText("123");
        marker.setChinaArea(ChinaArea.NeiMengGu);
        marker.setTextColor(Color.BLUE);
        marker.setTextSize(ResourceUtils.spTopx(10));
        markers.add(marker);

        marker = new Marker();
        marker.setIcon(ContextCompat.getDrawable(this, R.drawable.zui_icon_checked));
        marker.setText("1511");
        marker.setChinaArea(ChinaArea.SiChuan);
        marker.setTextColor(Color.YELLOW);
        marker.setTextSize(ResourceUtils.spTopx(10));
        markers.add(marker);

        marker = new Marker();
        marker.setIcon(ContextCompat.getDrawable(this, R.drawable.zui_icon_unchecked));
        marker.setText("0002");
        marker.setChinaArea(ChinaArea.ChongQing);
        marker.setTextColor(Color.BLACK);
        marker.setTextSize(ResourceUtils.spTopx(10));
        markers.add(marker);


        mChinaMapView.setMarkers(markers);
    }

    private void findViews() {
        mChinaMapView = findViewById(R.id.chinaMapView);
    }

    public void scaleBigger(View view) {
        mChinaMapView.scaleBigger();
    }

    public void scaleSmall(View view) {
        mChinaMapView.scaleSmall();
    }

}